#include<bits/stdc++.h>
using namespace std;
const int MAXN=2e5+5;
int n,m;
struct fru{
	int sum;
	int bh;
}a[MAXN],b[MAXN];
int main(){
	freopen("fruit.in","r",stdin);
	freopen("fruit.out","w",stdout);
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i].sum);
		a[i].bh=i;
	}
	while(n>0){
		int tn=n;
		for(int i=1;i<=tn;i++){
			if(a[i].sum!=a[i-1].sum || i==1){
				printf("%d ",a[i].bh);
			}
		}
		for(int i=1;i<=tn;i++){
			b[i]=a[i];
			if(a[i].sum!=a[i-1].sum || i==1)
				b[i].sum=-1;
		}
		for(int i=1;i<=tn;i++)a[i]=b[i];
		printf("\n");
		m=0;
		for(int i=1;i<=tn;i++)
			if(a[i].sum!=-1)
				b[++m]=a[i];
		n=m;
		for(int i=1;i<=n;i++)a[i]=b[i];
	}



	return 0;
}

